#!/usr/bin/perl
#Programmer: Rory Carmichael
#Purpose: Get discretized counts of %min-max values of a given mm file
#Usage: Cry for half an hour at the enormous waste of work your other program was and then do : discrize-mm.pl <input mm file>

#if ($#ARGV != 0) {
#	print STDERR "Usage: discretize-mm.pl <input mm file>\n";
#	exit 1;
#}

my @values;
my $stdev;
my $mean = 0;
my @discvals = ((0) x 200);
foreach my $line (<>) {
	chomp $line;
	if ($line !~ /^>/) {
		push(@values, split(/,/,$line));
	}
}
foreach my $val (@values) {
	$val = int( $val ) + 100;
	if ($val > 200) {
		print STDERR "GOT BAD BIN $val\n";
	}
	$discvals[$val-1]++;
}
for(my $i=0;$i<200;$i++) {
	my $val = $discvals[$i];
	print "$i\t$val\n";
}
print "======\n";
